﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;

namespace NICRUtils {
    class FileProcessor {


        public String receiverLocation;

        public void breakData(String filePath) {
            for (int i = 0; i < 0; i++) {

                FileInfo fi = new FileInfo(filePath);
                BinaryFormatter binform = new BinaryFormatter();

                byte[] fileData = new byte[fi.Length / 2];
                byte[] fileData1 = new byte[fi.Length / 2];

                

                if (fi.Length > 1) {

                    FileStream fs = new FileStream(filePath, FileMode.Open);

                    fs.Read(fileData, 0, fileData.Length);
                    fs.Read(fileData1, 0, fileData1.Length);

                    FilePacket fp1 = new FilePacket();

                    fp1.FileData = fileData;
                    fp1.IsClass = true;
                    binform.Serialize(new FileStream(receiverLocation + filePath + "_" + 1, FileMode.Open), fp1);


                    FilePacket fp2 = new FilePacket();

                    fp2.FileData = fileData;
                    fp2.IsClass = true;
                    binform.Serialize(new FileStream(receiverLocation + filePath + "_" + 2, FileMode.Open), fp2);


                } 
            }
            
        }

    }

}
